<template>
	<div>
		<el-transfer v-model="value" :data="roleList" :props="{key: 'value',label: 'name'}"></el-transfer>
		<div style="text-align: right;margin-top: 10px;">
			<el-button type="primary" size="small" @click="onOk">确定</el-button>
		</div>
	</div>
</template>

<script>
	import restUtil from '@/utils/restUtil.js';
	export default {
		name: "RelUserRolePage",
		props: ["currentId"],
		data() {
			return {
				value: [],
				roleList: [],
			}
		},mounted() {
			//this.init();
		},methods: {
			init(){
				var that = this;
				restUtil.getAction(this,"reluserrolepage/init?resUserId="+this.currentId).then(
					function(response) {
						if (response.data.code == 1) {
							that.roleList = response.data.roleList;
							that.value=response.data.valueList;
						} else {
							that.$alert(response.data.message, '提示')
						}
					});
			},
			onOk() {
				var that = this;
				var request={
					"valueList":that.value,
					"resUserId":this.currentId
				};
				restUtil.postAction(this,"reluserrolepage/dataSave",request).then(
					function(response) {
						if (response.data.code == 1) {
							that.$emit("closeDialogEvent",this);
						} else {
							that.$alert(response.data.message, '提示')
						}
					});
			}
		},
	}
</script>

<style>
</style>
